package com.chanyachting.emall.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;

import com.chanyachting.emall.util.RequestUtil;

public class ChannelForm extends ActionForm {
	
	
	// primary key
	private java.lang.Integer id;

	// fields
	private java.lang.Integer parentChannelId;
	private java.lang.Integer pri;
	private java.lang.String status;
	private java.lang.String createDate;
	private java.lang.String name;
	private java.lang.String productType;
	private java.lang.String type;
	
	
	
	
	public java.lang.String getType() {
		return type;
	}
	public void setType(java.lang.String type) {
		this.type = type;
	}
	public java.lang.String getProductType() {
		return productType;
	}
	public void setProductType(java.lang.String productType) {
		this.productType = productType;
	}
	public java.lang.Integer getId() {
		return id;
	}
	public void setId(java.lang.Integer id) {
		this.id = id;
	}
	public java.lang.Integer getParentChannelId() {
		return parentChannelId;
	}
	public void setParentChannelId(java.lang.Integer parentChannelId) {
		this.parentChannelId = parentChannelId;
	}
	public java.lang.Integer getPri() {
		return pri;
	}
	public void setPri(java.lang.Integer pri) {
		this.pri = pri;
	}
	public java.lang.String getStatus() {
		return status;
	}
	public void setStatus(java.lang.String status) {
		this.status = status;
	}
	public java.lang.String getCreateDate() {
		return createDate;
	}
	public void setCreateDate(java.lang.String createDate) {
		this.createDate = createDate;
	}
	public java.lang.String getName() {
		return name;
	}
	public void setName(java.lang.String name) {
		this.name = name;
	}
	
	@Override
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		
		
		ActionErrors errors=new ActionErrors();
		
		if(this.getName()==null || this.getName().trim().equals("")){
			
			errors.add("sellname", new ActionMessage("errors.chinnel.nameEmpty")); 
			
			new RequestUtil(request).setMsg("name must not null!");
		}
		
		return errors;
	}
	
	
	
	
	
	

}
